home *** CD-ROM | disk | FTP | other *** search
/ Champak Vol A-4 / (Vol A-4) Vol. A4.iso / Games / puppy_red.swf / scripts / DefineSprite_46_enermy / frame_1 / PlaceObject2_21_10 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Text File  |  2008-03-11  |  3KB  |  81 lines

  1. onClipEvent(enterFrame){
  2.    if(!_global.dead)
  3.    {
  4.       if(fly == 0)
  5.       {
  6.          firedelay = Math.floor(getTimer() / 1000) - enstartpo;
  7.          if(firedelay >= firetime)
  8.          {
  9.             if(angle > - randangle)
  10.             {
  11.                this.angle--;
  12.                posin2._rotation = - angle;
  13.             }
  14.             if(angle < - randangle)
  15.             {
  16.                this.angle = this.angle + 1;
  17.                posin2._rotation = - angle;
  18.             }
  19.             poz.attachMovie("enpo",po,1);
  20.             posin2._rotation = - angle;
  21.             poz[po]._rotation = - angle;
  22.             poz[po]._x = 0;
  23.             poz[po]._y = 0;
  24.             startx = poz[po]._x;
  25.             starty = poz[po]._y;
  26.             poz[po]._alpha = 0;
  27.             v = random(70) - 100;
  28.             posin2.play();
  29.          }
  30.       }
  31.       if(angle == - randangle && posin2.balsa == 1)
  32.       {
  33.          fly = 1;
  34.          t += 0.15;
  35.          vy0 = v * Math.sin(angle * 3.141592653589793 / 180);
  36.          vx0 = v * Math.cos(angle * 3.141592653589793 / 180);
  37.          vy = vy0 - gravitation * t;
  38.          poz[po]._x = (startx + vx0 * t) * 1.5;
  39.          poz[po]._y = (starty - vy0 * t + 0.5 * gravitation * t * t) * 1.5;
  40.          poz[po]._alpha = 100;
  41.          if(poz[po]._y >= 45)
  42.          {
  43.             mispozx = poz[po]._x;
  44.             mispozy = poz[po]._y;
  45.             tankpozx = _parent._x;
  46.             tankpozy = _parent._y;
  47.             if(poz[po].hitTest(_parent._parent.rand))
  48.             {
  49.                p++;
  50.                _parent._parent.attachMovie("randmiss",randmiss,40000 + p);
  51.                _parent._parent[randmiss]._x = mispozx + tankpozx;
  52.                _parent._parent[randmiss]._y = mispozy + tankpozy;
  53.                poz[po].removeMovieClip();
  54.                t = 0;
  55.                fly = 0;
  56.                posin2.balsa = 0;
  57.                enstartpo = Math.floor(getTimer() / 1000);
  58.                randangle = random(70) + 10;
  59.                firetime = random(4) + 1;
  60.                v = 0;
  61.             }
  62.             else
  63.             {
  64.                p++;
  65.                _parent._parent.attachMovie("miss",miss,40000 + p);
  66.                _parent._parent[miss]._x = mispozx + tankpozx - 10;
  67.                _parent._parent[miss]._y = mispozy + tankpozy;
  68.                poz[po].removeMovieClip();
  69.                t = 0;
  70.                fly = 0;
  71.                posin2.balsa = 0;
  72.                enstartpo = Math.floor(getTimer() / 1000);
  73.                randangle = random(70) + 10;
  74.                firetime = random(4) + 1;
  75.                v = 0;
  76.             }
  77.          }
  78.       }
  79.    }
  80. }
  81.